﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcreport.Web.reportinfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtrid.Text))
			{
				strErr+="rid格式错误！\\n";	
			}
			if(this.txtrname.Text.Trim().Length==0)
			{
				strErr+="反映人姓名不能为空！\\n";	
			}
			if(this.txtrtel.Text.Trim().Length==0)
			{
				strErr+="联系电话不能为空！\\n";	
			}
			if(this.txtremail.Text.Trim().Length==0)
			{
				strErr+="电子邮件不能为空！\\n";	
			}
			if(this.txtrdiqu.Text.Trim().Length==0)
			{
				strErr+="所属地区不能为空！\\n";	
			}
			if(this.txtradd.Text.Trim().Length==0)
			{
				strErr+="联系地址不能为空！\\n";	
			}
			if(this.txtrssd.Text.Trim().Length==0)
			{
				strErr+="问题所属地不能为空！\\n";	
			}
			if(this.txtrwork.Text.Trim().Length==0)
			{
				strErr+="被反映人（单位）不能为空！\\n";	
			}
			if(this.txtrobject.Text.Trim().Length==0)
			{
				strErr+="被反映对象不能为空！\\n";	
			}
			if(this.txtrtype.Text.Trim().Length==0)
			{
				strErr+="问题类别不能为空！\\n";	
			}
			if(this.txtrtypesub.Text.Trim().Length==0)
			{
				strErr+="问题细类不能为空！\\n";	
			}
			if(this.txtrtitle.Text.Trim().Length==0)
			{
				strErr+="标题不能为空！\\n";	
			}
			if(this.txtrtext.Text.Trim().Length==0)
			{
				strErr+="主要问题不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtrdate.Text))
			{
				strErr+="rdate格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtuid.Text))
			{
				strErr+="uid格式错误！\\n";	
			}
			if(this.txtrfile1.Text.Trim().Length==0)
			{
				strErr+="rfile1不能为空！\\n";	
			}
			if(this.txtrfile2.Text.Trim().Length==0)
			{
				strErr+="rfile2不能为空！\\n";	
			}
			if(this.txtrfile3.Text.Trim().Length==0)
			{
				strErr+="rfile3不能为空！\\n";	
			}
			if(this.txtrfile4.Text.Trim().Length==0)
			{
				strErr+="rfile4不能为空！\\n";	
			}
			if(this.txtrfile5.Text.Trim().Length==0)
			{
				strErr+="rfile5不能为空！\\n";	
			}
			if(this.txtrresult.Text.Trim().Length==0)
			{
				strErr+="rresult不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int rid=int.Parse(this.txtrid.Text);
			string rname=this.txtrname.Text;
			string rtel=this.txtrtel.Text;
			string remail=this.txtremail.Text;
			string rdiqu=this.txtrdiqu.Text;
			string radd=this.txtradd.Text;
			string rssd=this.txtrssd.Text;
			string rwork=this.txtrwork.Text;
			string robject=this.txtrobject.Text;
			string rtype=this.txtrtype.Text;
			string rtypesub=this.txtrtypesub.Text;
			string rtitle=this.txtrtitle.Text;
			string rtext=this.txtrtext.Text;
			DateTime rdate=DateTime.Parse(this.txtrdate.Text);
			int uid=int.Parse(this.txtuid.Text);
			string rfile1=this.txtrfile1.Text;
			string rfile2=this.txtrfile2.Text;
			string rfile3=this.txtrfile3.Text;
			string rfile4=this.txtrfile4.Text;
			string rfile5=this.txtrfile5.Text;
			string rresult=this.txtrresult.Text;

			lcreport.Model.reportinfo model=new lcreport.Model.reportinfo();
			model.rid=rid;
			model.rname=rname;
			model.rtel=rtel;
			model.remail=remail;
			model.rdiqu=rdiqu;
			model.radd=radd;
			model.rssd=rssd;
			model.rwork=rwork;
			model.robject=robject;
			model.rtype=rtype;
			model.rtypesub=rtypesub;
			model.rtitle=rtitle;
			model.rtext=rtext;
			model.rdate=rdate;
			model.uid=uid;
			model.rfile1=rfile1;
			model.rfile2=rfile2;
			model.rfile3=rfile3;
			model.rfile4=rfile4;
			model.rfile5=rfile5;
			model.rresult=rresult;

			lcreport.BLL.reportinfo bll=new lcreport.BLL.reportinfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
